package xyz.liut.onmyojihelper.runnable

import android.os.Handler
import xyz.liut.onmyojihelper.CoreService

/**
 * 计时器
 *
 * Created by liut on 17-11-5.
 */
class TimeRunnable(private val handler: Handler, var time: Int) : Runnable {

    override fun run() {
        try {
            while (time > 0) {
                Thread.sleep(200)
                time--
                handler.sendEmptyMessage(CoreService.HEART_BEATS)
            }
        } catch (e: Exception) {
            e.printStackTrace()
        }

    }

}